package com.ingenieria.industrial.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class Comun {

    @RequestMapping(params = "action=mision_vision")
    public ModelAndView mostrarMisionVision(HttpServletRequest request) {
        HttpSession sesion = request.getSession();
        ModelAndView mav = new ModelAndView("main.comun.mision_vision");
        mav.addObject("cod_usu", sesion.getAttribute("cod_usu"));
        mav.addObject("cod_rol", sesion.getAttribute("cod_rol"));
        mav.addObject("usuario_nombre", sesion.getAttribute("nombre"));
        return mav;
    }

    @RequestMapping(params = "action=historia")
    public ModelAndView mostrarHistoria(HttpServletRequest request) {
        HttpSession sesion = request.getSession();
        ModelAndView mav = new ModelAndView("main.comun.historia");
        mav.addObject("cod_usu", sesion.getAttribute("cod_usu"));
        mav.addObject("cod_rol", sesion.getAttribute("cod_rol"));
        mav.addObject("usuario_nombre", sesion.getAttribute("nombre"));
        return mav;
    }
}
